package com.xianyu.open.restclient.factory;

import com.xianyu.open.restclient.constants.RestClientGlobalConstants;
import com.xianyu.open.restclient.proxy.JdkProxyCreator;
import com.xianyu.open.restclient.proxy.ProxyCreator;
import org.springframework.util.StringUtils;

/**
 *
 * @author bailinan
 * @date 2018/7/19
 */
public class ProxyCreatorFactoryBean {
    private static ProxyCreator proxyCreator;
    public static ProxyCreator getProxyCreator(){
        return getProxyCreator(null);
    }
    public static ProxyCreator getProxyCreator(String type){
        if (proxyCreator == null){
            if (StringUtils.isEmpty(type) || RestClientGlobalConstants.JDK_PROXY_TYPE.equals(type)){
                proxyCreator = new JdkProxyCreator();
            }
        }
        return proxyCreator;
    }
}
